#!/usr/bin/python
# coding=utf-8

import plotly.plotly
import pandas as pd
import plotly.figure_factory as ff


class Violin:
    def __init__(self):
        print "violin图表生成类！"

    def makeViolin(self, score, group, title, name):
        data = pd.DataFrame(dict(Score=score, Group=group))
        fig = ff.create_violin(data, data_header='Score', group_header='Group', height=700, width=1200, title=title)
        plotly.offline.plot(fig, filename=name + ".html")


if __name__ == "__main__":
    sss = Violin()
    aaaa = [1, 3, 4, 6, 78, 99, 77]
    bbbb = ["a", "a", "a", "a", "bb", "bb", "bb"]
    sss.makeViolin(aaaa, bbbb, "接口请求时间")
